package model.pojo;

import java.sql.ResultSet;

import models.util.MySqlDataAccessHelper;

public class AcProjectCode {
	private String projectCodeID="";
	private String projectName="";
	private String menu;
	private String menuIn;
	private String groupCode1ID="";
	private String groupCode2ID="";
	private String remark="";
	private int activeSt=1;
	private String activeStName="";
	private boolean menuAc;
	private boolean menuStock;
	private boolean menuGW;
	private String gc1Name="";
	private String gc2Name="";
	
	private boolean checked;
	private boolean viewCheck;
	
	
	
	public boolean isChecked() {
		return checked;
	}
	public void setChecked(boolean checked) {
		this.checked = checked;
	}
	public boolean isViewCheck() {
		if(this.activeSt==1){
			viewCheck=true;
		}else
			viewCheck=false;
		return viewCheck;
	}
	public void setViewCheck(boolean viewCheck) {
		this.viewCheck = viewCheck;
	}
	public String getGc1Name() {
		if(this.groupCode1ID.equals("")==false){
			MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
			try{
				helper.open();	
				String sql="select ac_groupcode1.GroupCode1Name from ac_groupcode1 where ac_groupcode1.GroupCode1ID='"+this.groupCode1ID+"'";
				ResultSet rs = helper.executeQuery(sql);
				if(rs.next()){
					gc1Name=rs.getString("GroupCode1Name");
				}
				rs.close();
			}catch(Exception e){
				e.fillInStackTrace();
			}finally{
				helper.close();
			}
		}else
			gc1Name="";
		
		return gc1Name;
	}
	public void setGc1Name(String gc1Name) {
		this.gc1Name = gc1Name;
	}
	public String getGc2Name() {
		if(this.groupCode2ID.equals("")==false){
			MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
			try{
				helper.open();	
				String sql="select ac_groupcode2.GroupCode2Name from ac_groupcode2 where ac_groupcode2.GroupCode2ID='"+this.groupCode2ID+"'";
				ResultSet rs = helper.executeQuery(sql);
				if(rs.next()){
					gc2Name=rs.getString("GroupCode2Name");
				}
				rs.close();
			}catch(Exception e){
				e.fillInStackTrace();
			}finally{
				helper.close();
			}
		}else
			gc2Name="";		
		return gc2Name;
	}
	public void setGc2Name(String gc2Name) {
		this.gc2Name = gc2Name;
	}
	public String getMenuIn() {
		String s1="";
		String s2="";
		String s3="";
		if(this.isMenuAc()==true){
			s1="1";
		}else{
			s1="0";
		}
		if(this.isMenuStock()==true){
			s2="1";
		}else{
			s2="0";
		}
		if(this.isMenuGW()==true){
			s3="1";
		}else{
			s3="0";
		}
		menuIn=s1+";"+s2+";"+s3;
		return menuIn;
	}
	public void setMenuIn(String menuIn) {
		this.menuIn = menuIn;
	}
	public String getProjectCodeID() {
		return projectCodeID;
	}
	public void setProjectCodeID(String projectCodeID) {
		this.projectCodeID = projectCodeID;
	}
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	public String getMenu() {
		return menu;
	}
	public void setMenu(String menu) {
		
		this.menu = menu;
	}
	public String getGroupCode1ID() {
		return groupCode1ID;
	}
	public void setGroupCode1ID(String groupCode1ID) {
		this.groupCode1ID = groupCode1ID;
	}
	public String getGroupCode2ID() {
		return groupCode2ID;
	}
	public void setGroupCode2ID(String groupCode2ID) {
		this.groupCode2ID = groupCode2ID;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public int getActiveSt() {
		return activeSt;
	}
	public void setActiveSt(int activeSt) {
		this.activeSt = activeSt;
	}
	public String getActiveStName() {
		return activeStName;
	}
	public void setActiveStName(String activeStName) {
		this.activeStName = activeStName;
	}
	public boolean isMenuAc() {
		return menuAc;
	}
	public void setMenuAc(boolean menuAc) {
		this.menuAc = menuAc;
	}
	public boolean isMenuStock() {
		return menuStock;
	}
	public void setMenuStock(boolean menuStock) {
		this.menuStock = menuStock;
	}
	public boolean isMenuGW() {
		return menuGW;
	}
	public void setMenuGW(boolean menuGW) {
		this.menuGW = menuGW;
	}
	

		
}
